'use strict';
require('./index.css'); 
require('page/common/nav/index.js');
require('page/common/header/index.js');

var navSide = require('page/common/nav-side/index.js');
console.log('navSide', navSide)
	
var _mm = require('util/mm.js');

var userService = require('service/user-service.js');

var templateIndex = require('./index.string');

/*
console.log(templateIndex)

var userHtml = _mm.renderHtml(templateIndex, {
 	username: '刘阿勇',
 	email: 'liauyong@qq.com'
});
console.log(userHtml)

*/

var page = { 
	init: function() {
		this.onLoad()
	},
	onLoad: function() {
		navSide.init({
			name: 'user-center'
		})
		this.loadUserInfo();
	},
	loadUserInfo: function() {
		var userHtml = '';
		userService.getUserInfo(function(res){
			userHtml = _mm.renderHtml(templateIndex, res)
			$('.panel-body').html(userHtml)
		}, function(errMsg) {
			_mm.errorTips(errMsg)
		}) 
	}
}


$(function() {
	page.init()
})

